﻿<?php 
class Default_Form_Contact extends Zend_Form{
    
   public function init(){
        $this->setMethod("post");
		$this->setName("ContactForm");
        $this->setAttrib('autocomplete', 'off');	        	
        $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
        $this->setElementDecorators(array(
            array('ViewHelper'),
            array('Errors'),
            array('Description'),
            array('Label', array('separator'=>' ')),
            array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
        ));
$SS = new Zend_Session_Namespace ('Language');

$lang = $SS->language;
$langSendmail = "Gửi email";
  if($lang == "en"){
  $langSendmail = "Send email";  
  }elseif($lang == "chi"){
  $langSendmail = "發送電子郵件";  
  }
  
  $langName = "Tên";
  if($lang == "en"){
  $langName = "Name";  
  }elseif($lang == "chi"){
  $langName = "名";  
  }
  
   $langMobile = "Điện thoại";
  if($lang == "en"){
  $langMobile = "Mobile";  
  }elseif($lang == "chi"){
  $langMobile = "移動";  
  }
  
  $langContent = "Nội dung";
  if($lang == "en"){
  $langContent = "Content";  
  }elseif($lang == "chi"){
  $langContent = "內容";  
  }
  
  $langEmail = "Email";
  if($lang == "en"){
  $langEmail = "Email";  
  }elseif($lang == "chi"){
  $langEmail = "電子郵件";  
  }


        $name = new Zend_Form_Element_Text('name');
        $name->setLabel($langName)
             ->setRequired(true)
             ->addValidator('NotEmpty',true,array('messages' => $lang == "en" ? "Not empty" : "Tên không được chống"));
        $name->setAttrib('size', '45');
        
        
        
		$mobile = new Zend_Form_Element_Text('mobile');
        $mobile->setLabel($langMobile)
             ->setRequired(true)
             ->addValidator('NotEmpty',true,array('messages' => $lang == "en" ? "Not empty" : "Điện thoại không được để chống!"));
        $mobile->setAttrib('size', '45');
		
		
		
		$content = new Zend_Form_Element_Textarea('content');
        $content->setLabel($langContent);
            
		
		$email = new Zend_Form_Element_Text('email');
        $email->setLabel($langEmail)
             ->setRequired(true)
             ->addValidator('NotEmpty',true,array('messages' => $lang == "en" ? "Not empty" : "Email không được để chống!"));
        $email->setAttrib('size', '45');
		
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($langSendmail);
        $submit->class = "bt-save";
        
        $this->addElements(array($name, $mobile, $email, $content,
        $submit));                                           
    }  
}
